package main;

import java.io.File;

import objects.ClientImpl;

public class ShareMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new ShareMain();
	}

	public ShareMain() {
		try

		{
			ClientImpl l1 = new ClientImpl(new File("./torrent/client1"), "rmi://localhost:1099/Tracker");
			l1.share(new File("./torrent/Glorious.mp3"));
			System.out.println("flow split : "+l1.getUp());
			System.out.println("Ratio of client 1 before downloading : "+l1.getRatio());
			System.out.println(l1.UptoString());

			l1.share(new File("./torrent/Battle.mp3"));
			System.out.println("flow split : "+l1.getUp());
			System.out.println("Ratio of client 1 before downloading : "+l1.getRatio());
			System.out.println(l1.UptoString());

			ClientImpl l2 = new ClientImpl(new File("./torrent/client2"), "rmi://localhost:1099/Tracker" );
			l2.share(new File("./torrent/Glorious.mp3"));
			System.out.println("flow split : "+l2.getUp());
			System.out.println("Ratio of client 2 before downloading : "+l2.getRatio());
			System.out.println(l2.UptoString());

			l2.share(new File("./torrent/Battle.mp3"));
			System.out.println("flow split : "+l2.getUp());
			System.out.println("Ratio of client 2 before downloading : "+l2.getRatio());
			System.out.println(l2.UptoString());

			ClientImpl l3 = new ClientImpl(new File("./torrent/client3"), "rmi://localhost:1099/Tracker");
			l3.share(new File("./torrent/Glorious.mp3"));
			System.out.println("flow split : "+l3.getUp());
			System.out.println("Ratio of client 3 before downloading : "+l3.getRatio());
			System.out.println(l3.UptoString());

			l3.share(new File("./torrent/Battle.mp3"));
			System.out.println("flow split : "+l3.getUp());
			System.out.println("Ratio of client 3 before downloading : "+l3.getRatio());
			System.out.println(l3.UptoString());
		}
		catch (Exception e) { e.printStackTrace(); }
	}
}

